//
//  Model.m
//  日夜间模式
//
//  Created by dllo on 15/9/24.
//  Copyright (c) 2015年 S1mpl3. All rights reserved.
//

#import "Model.h"
#import "Color.h"
static Model *model;
@implementation Model


+(Model *)shareInstance{
    static dispatch_once_t once_token;
    dispatch_once(&once_token, ^{
        model = [[Model alloc] init];
//        NSLog(@"%ld", [[NSUserDefaults standardUserDefaults] integerForKey:@"night"]);
        if ([[NSUserDefaults standardUserDefaults] integerForKey:@"night"] == 0) {
            model.TitleColor = NightColor;
            model.TitleString = @"black";
            model.ViewString = @"white";
            model.BackgroundColor = dayColor;
            model.ViewColor = dayColor;
            [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES];
        }else if ([[NSUserDefaults standardUserDefaults] integerForKey:@"night"] == 1){
            model.TitleColor = dayColor;
            model.TitleString = @"white";
            model.ViewString = @"gray";
            model.BackgroundColor = DarkColor;
            model.ViewColor = LightColor;
            [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
        }
    });
    return model;
}

-(void)changeColor:(NSInteger)flag{
    if (flag == 0) {
        model.TitleColor = NightColor;        
        model.BackgroundColor = DarkColor;
        model.ViewColor = dayColor;
        model.TitleString = @"black";
        model.ViewString = @"white";
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES];
    }else if (flag == 1){
        model.TitleColor = dayColor;
        model.TitleString = @"white";
        model.ViewString = @"gray";
        model.BackgroundColor = LightColor;
        model.ViewColor = LightColor;
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
    }
}
@end
